//
//  ArticleModel.m
//  news_ios_app
//
//  Created by apple on 16/3/15.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "ArticleModel.h"

@implementation ArticleModel
-(instancetype)init
{
    if (self = [super init]) {
        _from = nil;
        _thumbnail_url = nil;
        _subTitle = nil;
        _ID = nil;
        _type_id = nil;
        _title = nil;
        _create_time = nil;
    }
    return self;
}

+(instancetype)modelWithDictionary:(NSDictionary *)dictionary
{
    ArticleModel *instance = [ArticleModel new];
    
    if (!dictionary) {
        return nil;
    }
    
    if (![dictionary isKindOfClass:[NSDictionary class]]) {
        return nil;
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"from"])) {
        instance.from = [dictionary objectForKey:@"from"];
    }
    if (!IsStrEmpty([dictionary objectForKey:@"thumbnail_url"])) {
        instance.thumbnail_url = [dictionary objectForKey:@"thumbnail_url"];
    }
    if (!IsStrEmpty([dictionary objectForKey:@"subtitle"])) {
        instance.subTitle = [dictionary objectForKey:@"subtitle"];
    }
    
    if (!IsNilOrNull([dictionary objectForKey:@"id"])) {
        instance.ID = [[dictionary objectForKey:@"id"] stringValue];
    }
    
    if (!IsNilOrNull([dictionary objectForKey:@"type_id"])) {
        instance.type_id = [[dictionary objectForKey:@"type_id"] stringValue];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"title"])) {
        instance.title = [dictionary objectForKey:@"title"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"create_time"])) {
        instance.create_time = [dictionary objectForKey:@"create_time"];
    }
    return instance;
}


- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [[self class]modelWithDictionary:dictionary];
    return self;
}

-(CGFloat)heightWithModel
{
    return 50;
}
@end
